<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <head th:include="common/common_head :: commonHead('系统日志管理')"></head>
</head>
<body class="larryms-auth">
<div class="layui-row larryms-panel">
    <div class="larryms-panel-heading layui-col-lg12 layui-col-md12 layui-col-sm12 layui-col-xs12">
        <span class="panel-tit">系统任务列表</span>
    </div>
    <div class="larryms-panel-body layui-col-lg12 layui-col-md12 layui-col-sm12 layui-col-xs12">
        <div class="larryms-tools">
            <form id="queryForm">
                <div class="larryms-search-box">
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input class="layui-input" height="20px" id="startTime"
                                   name="startTime" autocomplete="off" placeholder="开始时间"/>
                        </div>
                        <div class="layui-input-inline">
                            <input class="layui-input" height="20px" id="endTime"
                                   name="endTime" autocomplete="off" placeholder="结束时间"/>
                        </div>
                        <a class="layui-btn larryms-search" id="searchBtn" data-type="query"
                           data-form="queryForm"><i class="layui-icon layui-icon-search"></i>搜索</a>
                        <a class="layui-btn larryms-search" id="reloadBtn" data-type="reload"
                           data-form="queryForm"><i class="layui-icon layui-icon-refresh"></i></a>
                    </div>
                </div>
            </form>
        </div>
        <div class="layui-col-lg12 layui-col-md12 layui-col-sm12 layui-col-xs12">
            <table id="logList" lay-filter="logList" class="larryms-table-id"
                   th:attr="data-url=@{/system/log/list}"></table>
        </div>
    </div>
</div>
<script type="text/javascript" th:src="@{/static/larryms/layui/layui.js}"/>
<script th:inline="javascript">/*<![CDATA[*/
var bathPath = /*[[@{/}]]*/ "/";
layui.cache.page = "task";
layui.config({
    version: ui.version,
    base: bathPath + 'static/larryms/',  //实际使用时，建议改成绝对路径
    rightMenu: "none" // false关闭，设置为custom时使用自定义，不使用默认menu
}).extend({
    larry:'js/base'
}).use(['larry','table','laydate','custom'], function () {
    var table = layui.table,  $ = layui.$, beone = layui.custom,
            laydate = layui.laydate;

    laydate.render({  id:"startTime", elem:"#startTime" });
    laydate.render({  id:"endTime", elem:"#endTime" });

    var pageTableID = $('.larryms-table-id').attr('id');
    var dataUrl = $('#' + pageTableID).data('url')
    //方法级渲染
    table.render({
        id: pageTableID,  elem: '#' + pageTableID, method:'POST' , url: dataUrl
         ,cellMinWidth: 95 , cols: [[
              {field: 'nums', title: '序号', width: '3%', type:"numbers"}
            , {field: 'username', title: '操作用户', width: '9%'}
            , {field: 'ip', title: 'IP', width: '10%'}
            , {field: 'type', title: '类型', width: '6%'}
            , {field: 'content', title: '日志内容', width: '20%'}
            , {field: 'param', title: '操作相关参数', width: '40%'}
            , {field: 'createTime', title: '操作时间', width: '12%'}
        ]]
        , page: true, request:{pageName:'page',limitName:'rows'}, height: 'full-200'
    });

    var active = {
        query: function () {
            var formId = $(this).data("form");
            table.reload(pageTableID, {
                where: beone.serializeObject(formId)
            });
        },
        reload:function(){
            var formId = $(this).data("form");
            table.reload(pageTableID, {
                where: beone.clearForm(formId)
            });
        }
    };

    /*按钮事件绑定*/
    $("#searchBtn,#reloadBtn").on('click', function () {
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });
});
/*]]>*/</script>
</body>
</html>